<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.cn.chaomeng.constant.WxConstant" %>
<%
    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
    String webRoot = request.getContextPath() + "/";
    String webRootPath = request.getScheme() + "://"
//    String webRootPath =  "//"
            + request.getServerName();
    if (request.getServerPort() != 80)
    {
        webRootPath += ":" + request.getServerPort();
    }

    webRootPath += webRoot;
    request.setAttribute("webRoot", webRootPath);
%>
<html>
<head>
    <title>超盟</title>
</head>
<script type="text/javascript" src="${webRoot }static/js/jquery/jquery-1.11.3.min.js"></script>
<script type="text/javascript">



    var wx_appId = '<%= WxConstant.APPID %>';
    var wx_state  = '<%= WxConstant.WX_STATE %>';
    var webRoot = '${webRoot}';

    $(function(){
//        console.log( getUrl(webRoot+'/weixin/login'))
        window.location.href =  getUrl(webRoot+'weixin/login');
    });

    function getUrl(url) {
        var  urlEncoder = encodeURIComponent(url);
        return "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + wx_appId + "&redirect_uri="
                + urlEncoder + "&response_type=code&scope=snsapi_base&state=" + wx_state + "#wechat_redirect";
    }
</script>
<body>

</body>
</html>
